package com.tf_cut.backend.seller.service;


import java.util.List;

import com.tf_cut.backend.agent.mobile.vo.SellerOrderProviderVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.tf_cut.backend.common.pojo.PageInfo;
import com.tf_cut.backend.mapper.SellerAndAccountMapper;
import com.tf_cut.backend.seller.vo.SellerAndAccountVo;

@Service
@Transactional
public class SellerAndAccountServiceImpl implements SellerAndAccountService {
	
	@Autowired
	private SellerAndAccountMapper sellerAndAccountMapper;

	@Override
	public PageInfo<SellerAndAccountVo> findListSeller(SellerAndAccountVo avo) {
		com.github.pagehelper.PageHelper.startPage(avo.getPage(),avo.getRows());
		List<SellerAndAccountVo> list = sellerAndAccountMapper.findListSeller(avo);
		com.github.pagehelper.PageInfo<SellerAndAccountVo> pageinfo = new com.github.pagehelper.PageInfo<>(list);
		
		PageInfo<SellerAndAccountVo> returnPageInfo = new PageInfo<>();
		returnPageInfo.setPage(pageinfo.getPageNum());//页码
		returnPageInfo.setPageSize(pageinfo.getPageSize());//页面大小
		returnPageInfo.setRows(pageinfo.getList());//分页结果
		returnPageInfo.setRecords((int)pageinfo.getTotal());//总记录数
		returnPageInfo.setTotal(pageinfo.getPages());//总页数
		return returnPageInfo;
	}

	@Override
	public List<SellerAndAccountVo> findListWithSellerIds(List<String> ids,String agentName) {
		return sellerAndAccountMapper.findListWithSellerIds(ids,agentName);
	}

	@Override
	public List<SellerOrderProviderVo> sellerProviderDay(SellerOrderProviderVo sellerOrderProviderVo) {
		return sellerAndAccountMapper.sellerProviderDay(sellerOrderProviderVo);
	}

	@Override
	public List<SellerOrderProviderVo> sellerAmountWithAgentId(SellerOrderProviderVo sellerOrderProviderVo) {
		return sellerAndAccountMapper.sellerAmountWithAgentId(sellerOrderProviderVo);
	}

	@Override
	public List<SellerAndAccountVo> findSellerWithAgentId(String agentId) {
		return sellerAndAccountMapper.findSellerWithAgentId(agentId);
	}

	@Override
	public List<SellerAndAccountVo> findByCondition(SellerAndAccountVo avo) {
		return sellerAndAccountMapper.findByCondition(avo);
	}
}
